package com.msh.automatic.android.api.controller.admin;


import com.github.f4b6a3.uuid.UuidCreator;
import com.msh.automatic.android.api.entity.ActivationCode;
import com.msh.automatic.android.api.mapper.ActivationCodeMapper;
import com.msh.automatic.android.api.util.RetUtil;
import com.nimbusds.jose.jwk.JWKSet;
import io.swagger.annotations.ApiOperation;
import jakarta.annotation.Resource;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/a/activation_code")
public class ActivationCodeController {

    @Resource
    ActivationCodeMapper activationCodeMapper;
    @ApiOperation(value = "创建激活码")
    @RequestMapping(value = "create",method = RequestMethod.POST)
    public Object create(@RequestBody ActivationCode params) {
        ActivationCode activationCode = new ActivationCode();
        activationCode.setId(UuidCreator.getTimeOrderedEpoch().toString());
        activationCode.setValidityDay(params.getValidityDay());
        activationCode.setUserId(params.getUserId());
        activationCodeMapper.insert(activationCode);
        return RetUtil.success(activationCode);
    }

}
